-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: fix mockgen version #9127
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using fixed version totally makes sense, but tests fail
to fix:
on somehow the autogenerated mocks were edited manually, and not regenerated. |
@robert-zaremba what issue does this PR close? |
Oh, yes I used wrong number in description. Should be: #9282 (already updated). |
|
||
mockAnteDecorator2 := mocks.NewMockAnteDecorator(mockCtrl) | ||
mockAnteDecorator1.EXPECT().AnteHandle(gomock.Eq(ctx), gomock.Eq(tx), true, mockAnteDecorator2).Times(1) | ||
mockAnteDecorator2.EXPECT().AnteHandle(gomock.Eq(ctx), gomock.Eq(tx), true, nil).Times(1) | ||
sdk.ChainAnteDecorators(mockAnteDecorator1, mockAnteDecorator2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is something wrong here: this tests can't pass because in the last case the ante chain is not even called (sdk.ChainAnteDecorators
return a decorator, but we still need to call it).
I added a call but we can't correctly check the mockAnteDecorator2
as a expected argument - see the note in the code.
ret1, _ := ret[1].(error) | ||
return ret0, ret1 | ||
m.ctrl.Call(m, "AnteHandle", ctx, tx, simulate, next) | ||
return next(ctx, tx, simulate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The next
is not called in a generated code. So we have to customize the code. Since the test was not functioning, this function never worked as expected.
SOLUTION: I'm removing types_handlers
from auto - generated code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fdymylja - you were looking at the mocgen - did you solve it in any other way?
ae6c8fb
to
d9e4646
Compare
Codecov Report
@@ Coverage Diff @@
## master #9127 +/- ##
=======================================
Coverage 60.40% 60.40%
=======================================
Files 589 589
Lines 37095 37095
=======================================
+ Hits 22406 22407 +1
+ Misses 12712 12711 -1
Partials 1977 1977
|
This is ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* setup: update mockgen * Add expect ConsensusVersion in app_test * fix ChainAnteDecorators tests * remove types/handler.go from autogenerating mocks * adding a note * adding note Co-authored-by: Alessio Treglia <alessio@tendermint.com> Co-authored-by: Marko <marbar3778@yahoo.com>
Description
Closes: #9282
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes